<template>
  <div class="container is-scroll-bar">
    <div
      class="main-content is-scroll-bar"
      style="flex-direction: column; display: flex"
    >
      <div class="header-container">
        <el-menu
          :default-active="activeIndex"
          mode="horizontal"
          @select="handleSelect"
          class="title"
          style="width: 100%"
        >
          <el-menu-item index="1"> 危险作业管理 </el-menu-item>
        </el-menu>
      </div>
      <div class="main">
        <transition name="fade-right" mode="out-in">
          <router-view></router-view>
        </transition>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineComponent, ref } from "vue";
import router from "@/router";
const props = defineProps();
const message = "Hello, Vue 3!";
const activeIndex = ref("1");
const NewComponentName = defineComponent({
  name: "SafetyManagementIndex",
  setup() {
    return {
      message,
    };
  },
});

console.log(props);
console.log(NewComponentName);

const handleSelect = (key, keyPath) => {
  console.log(key, keyPath);
  if (key == "1") {
    if (router.currentRoute.path !== "/hazardousworkmanagement") {
      router.push("/hazardousworkmanagement");
    }
  }
};
</script>

<style lang="scss" scoped>
:deep(.main) {
  height: 100%;
}
:deep(.el-menu--horizontal > .el-submenu .el-submenu__title) {
  height: 54px;
  line-height: 54px;
}
.fade-right-enter-active,
.fade-right-leave-active {
  transition: opacity 0.1s;
}
.fade-right-enter,
.fade-right-leave-to {
  opacity: 0;
}

body {
  min-height: 100vh;

  transition: all 0.3s ease;
}
.container {
  padding: 15px;
  box-sizing: border-box;

  .main-content {
    background-color: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    min-width: 700px;
    .header-container {
      padding: 15px 15px;
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;

      .title {
        position: relative;
        font-weight: bold;
        color: #333;
        font-size: 15px;
        padding-left: 16px;

        &::before {
          content: "";
          width: 3px;
          height: 19px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 19px);
          position: absolute;
        }

        &::after {
          content: "";
          width: 3px;
          height: 16px;
          background-color: #82a848;
          left: 5px;
          top: calc(50% - 8px);
          position: absolute;
        }
      }
    }
  }
}

.main {
  padding: 12px 15px;
}

.w-100 {
  width: 100%;
}

.item-form-content {
  display: flex;
  flex-direction: row;
  align-items: center;

  i {
    margin: 0 10px;
  }
}

.productList-content {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  height: 40px;
}

.form-content {
  padding: 0 10px;
}

.dialog-action-bar {
  text-align: center;
  margin-top: 30px;
}
</style>
